﻿using Coding4Fun.MissionControl.WP.Misc;
using Coding4Fun.MissionControl.WP.Models;
using System.Collections.ObjectModel;

namespace Coding4Fun.MissionControl.WP.ViewModels
{
    public class MainPageViewModel : BindableBase
    {
        static MainPageViewModel instance = null;
        static readonly object padlock = new object();

        public MainPageViewModel()
        {
            Favorites = new ObservableCollection<Favorite>();
            Servers = new ObservableCollection<Server>();
        }

        public static MainPageViewModel Instance
        {
            get
            {
                lock (padlock)
                {
                    if (instance == null)
                    {
                        instance = new MainPageViewModel();
                    }
                    return instance;
                }
            }
        }

        private ObservableCollection<Favorite> _favorites;
        public ObservableCollection<Favorite> Favorites
        {
            get
            {
                return _favorites;
            }
            set
            {
                SetProperty(ref _favorites, value, "Favorites");
            }
        }

        private ObservableCollection<Server> _servers;
        public ObservableCollection<Server> Servers
        {
            get
            {
                return _servers;
            }
            set
            {
                SetProperty(ref _servers, value, "Servers");
            }
        }
    }
}
